package com.lc.luzhengtang.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.lc.luzhengtang.R;
import com.lc.luzhengtang.base.BaseActivity;
import com.lc.luzhengtang.bean.FanLiDetailBean;
import com.lc.luzhengtang.conn.ConnFanLi;
import com.zcx.helper.http.AsyCallBack;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.lc.luzhengtang.R.id.text_nickname;

/**
 * Created by Administrator on 2017/6/20.
 */
public class Personalconsumption extends BaseActivity {
    @BindView(R.id.img_news)
    ImageView imgNews;
    @BindView(R.id.text_normal_person)
    TextView textNormalPerson;
    @BindView(text_nickname)
    TextView textNickname;
    @BindView(R.id.text_huiyuan)
    TextView textHuiyuan;
    @BindView(R.id.text_xiaofeitime)
    TextView textXiaofeitime;
    @BindView(R.id.text_shop_name)
    TextView textShopName;
    @BindView(R.id.text_count)
    TextView textCount;
    @BindView(R.id.text_shouyi)
    TextView textShouyi;
    @BindView(R.id.text_pay_status)
    TextView textPayStatus;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_personal_sumption);
        ButterKnife.bind(this);
        getFanLiData();
    }

    @OnClick({R.id.img_news, R.id.text_normal_person, text_nickname, R.id.text_huiyuan, R.id.text_xiaofeitime, R.id.text_shop_name, R.id.text_count, R.id.text_shouyi, R.id.text_pay_status})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_news:
                finish();
                break;
            case R.id.text_normal_person:
                break;
            case text_nickname:
                break;
            case R.id.text_huiyuan:
                break;
            case R.id.text_xiaofeitime:
                break;
            case R.id.text_shop_name:
                break;
            case R.id.text_count:
                break;
            case R.id.text_shouyi:
                break;
            case R.id.text_pay_status:
                break;
        }
    }


    public void getFanLiData() {

        new ConnFanLi(getIntent().getStringExtra("id"), new AsyCallBack<FanLiDetailBean>() {
            @Override
            public void onStart(int type) throws Exception {
                super.onStart(type);
            }

            @Override
            public void onSuccess(String toast, int type, Object o, FanLiDetailBean s) throws Exception {
                super.onSuccess(toast, type, o, s);
//                text_nickname
                textNickname.setText(s.getData().getName());
                //成员类别 text_huiyuan
                textHuiyuan.setText(s.getData().getRole());
                //消费时间text_xiaofeitime
                textXiaofeitime.setText(s.getData().getCreate_time());
                //商品名称 text_shop_name
                textShopName.setText(s.getData().getGoods_title());
                //产品数量 text_count
                textCount.setText(s.getData().getNumber()+"");
                //收益金额text_shouyi
            textShouyi.setText(s.getData().getMoney());
                //支付方式text_pay_status
                if (s.getData().getPaytype().equals("1")){
                    textPayStatus.setText("银联");
                }else if (s.getData().getPaytype().equals("2")){
                    textPayStatus.setText("支付宝");
                }else if (s.getData().getPaytype().equals("3")){
                    textPayStatus.setText("微信");
                }else {
                    textPayStatus.setText("线下");
                }

            }

            @Override
            public void onFail(String toast, int type) throws Exception {
                super.onFail(toast, type);
            }

            @Override
            public void onEnd(String toast, int type) throws Exception {
                super.onEnd(toast, type);
            }
        }

        ).execute(Personalconsumption.this, false);


    }

}
